@extends('layout.admin')

@section('title', '管理员管理')

@section('content')
    <style>
        .edit-content{
            background-color: #fff;
            max-width: 100%;
            flex: 0 0 100%;
            padding: 0 10px;
        }

        .edit-content .edit-form{
            padding: 18px;
        }

        .edit-content .edit-form .col-form-label{
            text-align: right;
        }
        .edit-content .edit-form .input-inline{
            padding: .375rem .75rem;
        }

    </style>
    <div class="edit-content">
        @include('shared.adminAddHeader', [
        'addHeaderName' => '新增管理员',
        'svgIconName' => 'people',
        'addBackUrl' => url('admin/user/index'),
        'addSaveUrl' => url('admin/user/save'),
    ])

        <div class="edit-form">
            <form id="editForm">
                @if(isset($editObject->id))
                    <input type="hidden" name="id" value="{{$editObject->id}}">
                @endif
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label"><span class="text-danger">*</span>登录名称：</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="name" name="name" required
                               @if(isset($editObject->name)) value="{{$editObject->name}}" @else value="" @endif placeholder="请输入登录名称">
                    </div>
                </div>
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label"><span class="text-danger">*</span>角色：</label>
                    <div class="col-sm-9">
                        @if(!empty($roleArr))
                        <select id="roleId" name="role_id" class="form-control">
                            <option value="" selected>请选择角色</option>
                            @foreach($roleArr as $roleKey=>$roleVal)
                            <option value="{{$roleVal['id']}}"
                                    @if(isset($editObject->id) &&($editObject->role_id == $roleVal['id'])) selected @endif >{{$roleVal['name']}}</option>
                            @endforeach
                        </select>
                        @else
                            <div class="input-inline">没有角色数据请点击 <a href="{{url('admin/role/editRole')}}">添加角色</a></div>
                        @endif
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-3 form-lable-title col-form-label"><span class="text-danger">*</span>登录状态：</label>
                    <div class="col-sm-9 input-inline">
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="status" id="status0"
                                   checked value="0">
                            <label class="form-check-label" for="status0">禁用</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="status" id="status1"
                                   @if(isset($editObject->status['value']) && (1 == $editObject->status['value'])) checked @endif value="1">
                            <label class="form-check-label" for="status1">启用</label>
                        </div>
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-3 form-lable-title col-form-label">性别：</label>
                    <div class="col-sm-9 input-inline" style="">
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="sex" id="sex0"
                                   checked value="0">
                            <label class="form-check-label" for="sex0">保密</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="sex" id="sex1"
                                   @if(isset($editObject->status['value']) && (1 == $editObject->status['value'])) checked @endif value="1">
                            <label class="form-check-label" for="sex1">男</label>
                        </div>
                        <div class="form-check form-check-inline">
                            <input class="form-check-input" type="radio" name="sex" id="sex2"
                                   @if(isset($editObject->status['value']) && (2 == $editObject->status['value'])) checked @endif value="2">
                            <label class="form-check-label" for="sex2">女</label>
                        </div>
                    </div>
                </div>
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label">呢称：</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="nickname" name="nickname"
                               @if(isset($editObject->nickname)) value="{{$editObject->nickname}}" @else value="" @endif placeholder="请输入呢称">
                    </div>
                </div>
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label">真实姓名：</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="real_name" name="real_name"
                               @if(isset($editObject->real_name)) value="{{$editObject->real_name}}" @else value="" @endif placeholder="请输入真实姓名">
                    </div>
                </div>
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label">英文名：</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="en_name" name="en_name"
                               @if(isset($editObject->en_name)) value="{{$editObject->en_name}}" @else value="" @endif placeholder="请输入英文名">
                    </div>
                </div>
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label">联系电话：</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="phone" name="phone"
                               @if(isset($editObject->phone)) value="{{$editObject->phone}}" @else value="" @endif placeholder="请输入联系电话">
                    </div>
                </div>
                <div class="form-group row">
                    <label for="name" class="col-sm-3 form-lable-title col-form-label">职称：</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="position" name="position"
                               @if(isset($editObject->position)) value="{{$editObject->position}}" @else value="" @endif placeholder="请输入职称">
                    </div>
                </div>
            </form>
        </div>
    </div>

@endsection
